package com.sls.game.dao.xingxitian.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.sls.game.dao.impl.SuperDAO;
import com.sls.game.dao.xingxitian.XingAccountTypeDAO;
import com.sls.game.page.Pagination;
import com.sls.game.pojo.xingqitian.XingAccountTypeInfo;

/**
 * 
 * @description 星启天账户类型DAO
 * @author Wangxuegang
 * @date 2012-12-22
 */
@Repository("xingAccountTypeDAO")
public class XingAccountTypeDAOImpl extends SuperDAO<XingAccountTypeInfo>
		implements XingAccountTypeDAO {

	@Override
	public void insert(XingAccountTypeInfo info) {
		this.getSqlSession().insert("mybatis.xml.XingAccountTypeMapper.insert",
				info);
	}

	@Override
	public Pagination<XingAccountTypeInfo> queryAccountTypeInfo(
			XingAccountTypeInfo info) {
		Pagination<XingAccountTypeInfo> paginationList = null;
		Integer rowCount = queryRowCount(info);
		info.calculate();
		List<XingAccountTypeInfo> list = queryParvalueInfoList(info);
		paginationList = this.queryPagination(rowCount, list, info);
		return paginationList;
	}

	/**
	 * 查询记录总数
	 * 
	 * @param enLinkGoodsInfo
	 * @return
	 */
	private Integer queryRowCount(XingAccountTypeInfo info) {
		Integer rowCount = this.getSqlSession().selectOne(
				"mybatis.xml.XingAccountTypeMapper.queryRowCount", info);
		return rowCount;
	}

	/**
	 * 记录结果集list
	 * 
	 * @param enLinkGoodsInfo
	 * @return
	 */
	private List<XingAccountTypeInfo> queryParvalueInfoList(
			XingAccountTypeInfo info) {
		List<XingAccountTypeInfo> list = this
				.getSqlSession()
				.selectList(
						"mybatis.xml.XingAccountTypeMapper.queryXQTAccountTypeInfoList",
						info);
		return list;
	}

	/**
	 * 查询AccounttypeId
	 * 
	 * @param info
	 * @return
	 */
	@Override
	public String queryAccounttypeId(XingAccountTypeInfo info) {
		String accounttypeId = null;
		accounttypeId = this.getSqlSession().selectOne(
				"mybatis.xml.XingAccountTypeMapper.queryAccounttypeId", info);
		return accounttypeId;
	}

	/**
	 * 根据游戏文件对应编号，查询记录
	 * 
	 * @param gametype1
	 * @return
	 */
	@Override
	public List<XingAccountTypeInfo> queryRecordInfoByGametype1(String gametype1) {
		List<XingAccountTypeInfo> list = null;
		list = this.getSqlSession().selectList(
				"mybatis.xml.XingAccountTypeMapper.queryRecordInfoByGametype1",
				gametype1);
		return list;
	}

	/**
	 * 记录详情
	 * 
	 * @param id
	 * @return
	 */
	@Override
	public XingAccountTypeInfo queryAccountTypeInfoById(String id) {
		XingAccountTypeInfo info = null;
		info = this.getSqlSession().selectOne(
				"mybatis.xml.XingAccountTypeMapper.queryAccountTypeInfoById",
				id);
		return info;
	}

}
